﻿using com.fukefu.sql;
namespace com.fukefu.tools
{
    public class User
    {
        string uid, name, pass, wid;
        SqlServerOperate sql = new SqlServerOperate();
        //构造函数
        public User(string uid, string name, string pass, string wid)
        {
            this.uid = uid;
            this.name = name;
            this.pass = pass;
            this.wid = wid;
        }
        //获取用户已发布的文章数量
        public int GetUserPostArticleCount()
        {
            return sql.GetQueryNum("select count(id) from [已发布] where uid='" + uid + "'");
        }
        //获取用户今天已经发布的文章数量
        public int GetNowDayPostArticleCount()
        {
            return sql.GetQueryNum("select count(id) from [已发布] where datediff(d,dt,getdate())=0 and uid='" + uid + "'");
        }
        //停用账号
        public void StopUsing()
        {
            sql.Update("update [_site_账户] set flag=0 where uid='" + uid + "'");
        }
        public string Uid
        {
            get { return uid; }
        }
        public string Wid
        {
            get { return wid; }
        }
        public string Name
        {
            get { return name; }
        }
        public string Pass
        {
            get { return pass; }
        }
    }
}
